package com.Drools.敲定的几种模式;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;

public class droolsUtil {

    public static boolean ss(String cls,String ff,Map<String,Object> map) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {

        //:调用CLass的静态方法: forName(String classPath)
        Class<?> fsc = null;
        try {
            fsc = Class.forName(cls);//最能体现反射动态性
        } catch (ClassNotFoundException e) {e.printStackTrace();}

        Method show = fsc.getDeclaredMethod(ff,Map.class);
        //获取方法 第一个是方法名字 之后是参数类型
        show.invoke(null,map);//执行fs  的方法

        return true;
    }
    public static void ssssss(Map<String,Object> m){
        System.out.println(m);

    }
    public static void main(String[] args) throws InvocationTargetException, NoSuchMethodException, IllegalAccessException {
        Map m = new HashMap();
        m.put("测试","sss");
        ss("com.Drools.敲定的几种模式.droolsUtil","ssssss",m);
    }
}
